import { Logger } from "../utils/Logger";
import { WebSocketClient } from "./WebSocketClient";

export class WebSocketManager {

    public static instance: WebSocketManager = new WebSocketManager();

    public clientList: Array<WebSocketClient> = [];

    public getSocketClient(url: string) {
        for (let i = 0; i < this.clientList.length; i++) {
            let client: WebSocketClient = this.clientList[i];
            if (client.url == url) {
                return client;
            }
        }
    }

    public getSocketClientById(id: number) {
        for (let i = 0; i < this.clientList.length; i++) {
            let client: WebSocketClient = this.clientList[i];
            if (client.id == id) {
                return client;
            }
        }
    }

}